//判断请求是否成功
export function isSuccessed(res):boolean{
    return res && res.code === "0000";
}

/**
 * 下载Excel文件
 * @param res
 * @param fileName
 */
export function downloadExcel(res,fileName){
    if(!res){
        return;
    }
    const blob = new Blob([res],{type:"appliation/vnd.ms-excel"});
    const href = URL.createObjectURL(blob);
    const a = document.createElement("a");
    a.style.display = 'none';
    a.href = href;
    a.download = fileName;
    a.click();
    URL.revokeObjectURL(a.href);
}

/**
 * 下载ZIP文件
 * @param res 响应数据（Blob 或 ArrayBuffer）
 * @param fileName 下载后的文件名（如 example.zip）
 */
export function downloadZip(res, fileName) {
    if (!res) return;

    const blob = new Blob([res], { type: 'application/zip' });
    const href = URL.createObjectURL(blob);

    const a = document.createElement('a');
    a.style.display = 'none';
    a.href = href;
    a.download = fileName;
    a.click();
    URL.revokeObjectURL(href);
}


import { notification as pop } from "ant-design-vue"

export function notifySuccess(message:string,description:string = ''){
    pop.success({message, description});
}
export function notifyError(message:string,description:string = ''){
    pop.error({message, description});
}
